﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@this.Partial("Index-js")

<script>
    var activitynameList = @this.Raw(this.ViewBag.ActivityNameListString);
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="活动名字" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-bordered" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>活动</th>
                <th>时间</th>
                <th>描述</th>
                <th>人员</th>
            </tr>
        </thead>
        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:Name"></td>
                <td data-bind="dateString:Date"></td>
                <td data-bind="text:Description"></td>
                <td data-bind="text:People"></td>
            </tr>
        </tbody>
        @*@this.Partial("_tfoot")*@
    </table>
</div>

@using (Html.Dialog())
{
    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">活动名字</td>
                        <td class="formValue">
                            <input id="Name" name="Name" type="text" class="form-control required" placeholder="请输入活动名字" data-bind="value:Model().Name" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">活动时间</td>
                        <td class="formValue">
                            <input id="Date" name="Date" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="dateString:Model().Date" />
                        </td>
                    </tr>

                    <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">
                            活动人员Id
                        </td>
                        <td class="formValue" colspan="3">
                            <textarea id="People" name="People" class="form-control" style="height: 280px;" data-bind="value:Model().People" >
                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">
                            选择活动人员
                        </td>
                        <td class="formValue" colspan="3">
                            <select id="People2" name="People2" class="form-control">
                                @this.SelectOptions(this.ViewBag.ActivityNameList)
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle" valign="top" style="padding-top: 5px;">
                            备注
                        </td>
                        <td class="formValue" colspan="3">
                            <textarea id="Description" name="Description" class="form-control" style="height: 60px;" data-bind="value:Model().Description"></textarea>
                         </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
}